package com.codetci.rabbitmq;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author: zhenzhong.wang@honeywell.com
 * @date: 2019/10/14 2:33 PM
 */
@Component
public class RabbitmqListener {

  @RabbitListener(queues = {"queue1"})
  public void queue1Listener (Message message) {
    System.out.println("queue1 receive message");
    System.out.println(message.getBody());
  }

  @RabbitListener(queues = {"queue2"})
  public void queue2Listener (String message) {
    System.out.println("queue2 one receive message");
  }

//  @RabbitListener(queues = {"queue2"})
//  public void queue3Listener (String message) {
//    System.out.println("queue2 two receive message");
//  }

  @RabbitListener(queues = {"queue3"})
  public void queue4Listener (String message) {
    System.out.println("queue3 receive message");
  }
}
